import service from "@/utils/http";
import qs from 'qs'
export const login = (form:any) => {
    return service({
        method:"POST",
        url:"/login",
        headers:{'Content-Type': 'application/x-www-form-urlencoded'},
        data:qs.stringify(form)
    })
}

// 获取用户列表
export const getUserList = (pageNo:number,pageSize:number,orderType?:string|number,orderS?:string|number) => {
    return service({
        method:"GET",
        url:`/user/list/?pageNo=${pageNo}&pageSize=${pageSize}&orderType=${orderType}&orderS=${orderS}`
    })
}

// 用户注册
/**
 * @param {boolean|string|type} userType 1为管理员 默认0是普通用户
 * */
export const register = (userName:string,userPassword:string,userType:boolean|number|string) => {
    return service({
        method:"POST",
        url:"/register",
        data:{userName,userPassword,userType}
    })
}

// 删除用户
export const deleteUser = (userId:string|number) => {
    return service({
        url:`/user/delete/${userId}`,
        method:"GET"
    })
}
